package com.wawayaya.db;

import net.sqlcipher.database.SQLiteDatabase;

import java.util.Map;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.AbstractDaoSession;
import de.greenrobot.dao.identityscope.IdentityScopeType;
import de.greenrobot.dao.internal.DaoConfig;

import com.wawayaya.bean.Advert;
import com.wawayaya.bean.Area;
import com.wawayaya.bean.Banner;
import com.wawayaya.bean.BookShelf;
import com.wawayaya.bean.Books;
import com.wawayaya.bean.Config;
import com.wawayaya.bean.HomePage;
import com.wawayaya.bean.MyBookShelf;
import com.wawayaya.bean.Notice;
import com.wawayaya.bean.ReadRecord;
import com.wawayaya.bean.Support;
import com.wawayaya.bean.Timestamp;
import com.wawayaya.bean.User;
import com.wawayaya.db.basedao.AdvertDao;
import com.wawayaya.db.basedao.AreaDao;
import com.wawayaya.db.basedao.BannerDao;
import com.wawayaya.db.basedao.BooksDao;
import com.wawayaya.db.basedao.BookShelfDao;
import com.wawayaya.db.basedao.ConfigDao;
import com.wawayaya.db.basedao.HomePageDao;
import com.wawayaya.db.basedao.NoticeDao;
import com.wawayaya.db.basedao.SupportDao;
import com.wawayaya.db.basedao.UserDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see de.greenrobot.dao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig noteDaoConfig;
    private final DaoConfig userDaoConfig;
    private final DaoConfig bannerDaoConfig;
    private final DaoConfig configDaoConfig;
    private final DaoConfig bookShelfConfig;
    private final DaoConfig areaDaoConfig;
    private final DaoConfig supportConfig;
    private final DaoConfig noticeDaoConfig;
    private final DaoConfig homePageDaoConfig;
    private final DaoConfig advertDaoConfig;


    private final BooksDao bookDao;
    private final UserDao userDao;
    private final AreaDao areaDao;
    private final BannerDao bannerDao;
    private final ConfigDao configDao;
    private final SupportDao supportDao;
    private final NoticeDao noticeDao;
    private final BookShelfDao bookShelfDao;
    private final HomePageDao  homePageDao;
    private final AdvertDao    advertDao;

    public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        noteDaoConfig = daoConfigMap.get(BooksDao.class).clone();
        noteDaoConfig.initIdentityScope(type);

        userDaoConfig = daoConfigMap.get(UserDao.class).clone();
        userDaoConfig.initIdentityScope(type);

        areaDaoConfig = daoConfigMap.get(AreaDao.class).clone();
        areaDaoConfig.initIdentityScope(type);

        bannerDaoConfig = daoConfigMap.get(BannerDao.class).clone();
        bannerDaoConfig.initIdentityScope(type);

        configDaoConfig = daoConfigMap.get(ConfigDao.class).clone();
        configDaoConfig.initIdentityScope(type);

        supportConfig = daoConfigMap.get(SupportDao.class).clone();
        supportConfig.initIdentityScope(type);

        noticeDaoConfig = daoConfigMap.get(NoticeDao.class).clone();
        noticeDaoConfig.initIdentityScope(type);


        bookShelfConfig= daoConfigMap.get(BookShelfDao.class).clone();
        bookShelfConfig.initIdentityScope(type);

        homePageDaoConfig= daoConfigMap.get(HomePageDao.class).clone();
        homePageDaoConfig.initIdentityScope(type);

        advertDaoConfig = daoConfigMap.get(AdvertDao.class).clone();
        advertDaoConfig.initIdentityScope(type);


        bookDao = new BooksDao(noteDaoConfig, this);
        userDao = new UserDao(userDaoConfig, this);
        areaDao = new AreaDao(areaDaoConfig, this);
        bannerDao = new BannerDao(bannerDaoConfig, this);
        configDao = new ConfigDao(configDaoConfig, this);
        supportDao = new SupportDao(supportConfig,this);
        noticeDao = new NoticeDao(noticeDaoConfig, this);
        bookShelfDao = new BookShelfDao(bookShelfConfig,this);
        homePageDao = new HomePageDao(homePageDaoConfig,this);
        advertDao = new AdvertDao(advertDaoConfig,this);

        registerDao(Books.class, bookDao);
        registerDao(User.class, userDao);
        registerDao(Banner.class, bannerDao);
        registerDao(Config.class, configDao);
        registerDao(BookShelf.class,bookShelfDao);
        registerDao(Area.class, areaDao);
        registerDao(Notice.class, noticeDao);
        registerDao(Support.class,supportDao);
        registerDao(HomePage.class,homePageDao);
        registerDao(Advert.class,advertDao);
    }
    
    public void clear() {
        noteDaoConfig.getIdentityScope().clear();
        userDaoConfig.getIdentityScope().clear();

        bannerDaoConfig.getIdentityScope().clear();
        configDaoConfig.getIdentityScope().clear();
        bookShelfConfig.getIdentityScope().clear();
        areaDaoConfig.getIdentityScope().clear();
        supportConfig.getIdentityScope().clear();
        noticeDaoConfig.getIdentityScope().clear();
        homePageDaoConfig.getIdentityScope().clear();

        advertDaoConfig.getIdentityScope().clear();
    }



    public UserDao getUserDao() {
        return userDao;
    }
    public BooksDao getBookDao() {
        return bookDao;
    }
    public NoticeDao getNoticeDao() {
        return noticeDao;
    }

    public ConfigDao getConfigDao() {
        return configDao;
    }

    public BannerDao getBannerDao() {
        return bannerDao;
    }

    public BookShelfDao getBookShelfDao() {
        return bookShelfDao;
    }
    public AreaDao getAreaDao() {
        return areaDao;
    }

    public SupportDao getSupportDao() {
        return supportDao;
    }

    public HomePageDao getHomePageDao() {
        return homePageDao;
    }
    public AdvertDao getAdvertDao() {
        return advertDao;
    }

}
